<template>
  <view class="card-item">
    <view class="card-content">
      <view class="card-header">
        <text class="card-title">{{ item.platform }}</text>
      </view>
      <view class="card-details">
        <view class="detail-item">
          <text class="label">入口域名:</text>
          <text class="value">{{ item.domain }}</text>
        </view>
        <view class="detail-item">
          <text class="label">二级域名:</text>
          <text class="value">{{ item.sld }}</text>
        </view>
        <view class="detail-item">
          <text class="label">跳转地址:</text>
          <text class="value">{{ item.target }}</text>
        </view>
        <view class="detail-item">
          <text class="label">创建时间:</text>
          <text class="value">{{ item.create_time }}</text>
        </view>
      </view>
    </view>
    <view class="card-actions">
      <image src="/static/slh.png" class="action-image" @click="showMenu"></image>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      required: true
    },
    index: {
      type: Number,
      required: true
    }
  },
  methods: {
    showMenu() {
      this.$emit('showMenu', this.index);
    }
  }
};
</script>

<style scoped>
.card-item {
  margin: 24rpx;
  background: #ffffff;
  border-radius: 24rpx;
  box-shadow: 
    0 4rpx 6rpx rgba(57, 150, 100, 0.02),
    0 12rpx 16rpx rgba(57, 150, 100, 0.08);
  overflow: hidden;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80rpx;
  background: #399664;
  opacity: 1;
  border-radius: 24rpx 24rpx 0 0;
}

.card-hover {
  transform: translateY(-4rpx);
  box-shadow: 
    0 8rpx 12rpx rgba(34, 84, 61, 0.04),
    0 16rpx 24rpx rgba(34, 84, 61, 0.12);
  background: #fafafa;
}

.card-content {
  position: relative;
  padding: 32rpx;
  z-index: 1;
}

.card-header {
  margin-bottom: 32rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  position: relative;
  z-index: 2;
}

.card-title {
  font-size: 32rpx;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.5rpx;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 24rpx;
  background: #ffffff;
  padding: 24rpx;
  border-radius: 16rpx;
  box-shadow: inset 0 2rpx 4rpx rgba(57, 150, 100, 0.05);
}

.detail-item {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 12rpx 0;
  position: relative;
}

.detail-item:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: -12rpx;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(57, 150, 100, 0.1);
}

.label {
  font-size: 30rpx;
  color: #399664;
  min-width: 160rpx;
  font-weight: 600;
  letter-spacing: 0.5rpx;
}

.value {
  font-size: 28rpx;
  color: #2D3748;
  flex: 1;
  text-align: left;
  word-break: break-all;
  padding-left: 20rpx;
}

.card-actions {
  padding: 8rpx;
  border-radius: 8rpx;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.2);
  position: absolute;
  top: 16rpx;
  right: 16rpx;
  color: #ffffff;
}

.card-actions:hover {
  background: rgba(45, 106, 79, 0.1);
}

.action-dots {
  display: flex;
  gap: 6rpx;
}

.dot {
  width: 6rpx;
  height: 6rpx;
  border-radius: 50%;
  background-color: #399664;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20rpx);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-item {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-image {
  width: 32rpx;
  height: 32rpx;
  cursor: pointer;
}
</style>
